from extension.ext_sql import table_prefix,db


class Person(db.Model):
    """数据集模型"""
    __tablename__ = table_prefix + "person"
    # 字段定义
    id = db.Column(db.Integer, primary_key=True,comment="主键")
    name = db.Column(db.String(255), default='张三',comment="姓名")
    address = db.Column(db.String(255), default='默认',comment="地址")

    @property
    def to_dict(self):
        return {i.name: getattr(self, i.name) for i in self.__table__.columns}
